-- stack: in -- format: 8 (HyperCard 1) -- flags: 0x1000 (none) -- protect password hash: 0 -- maximum user level: 5 (scripting) -- window: Rect(x1=0, y1=0, x2=0, y2=0) -- screen: Rect(x1=0, y1=0, x2=0, y2=0) -- card dimensions: w=0 h=0 -- scroll: x=0 y=0 -- background count: 7 -- first background id: 6049 -- card count: 41 -- first card id: 5615 -- list block id: 22172 -- print block id: 10470 -- font table block id: 0 -- style table block id: 0 -- free block count: 9 -- free size: 16096 bytes -- total size: 262144 bytes -- stack block size: 9216 bytes -- created by hypercard version: 0x00000000 -- compacted by hypercard version: 0x01228000 -- modified by hypercard version: 0x01228000 -- opened by hypercard version: 0x01258000 -- patterns[0]: 0x0000000000000000 -- patterns[1]: 0x8000000008000000 -- patterns[2]: 0x8800220088002200 -- patterns[3]: 0x8888222288882222 -- patterns[4]: 0x88AA22AA88AA22AA -- patterns[5]: 0xCCAA33AACCAA33AA -- patterns[6]: 0xEEAABBAAEEAABBAA -- patterns[7]: 0xEEBBBBEEEEBBBBEE -- patterns[8]: 0xFFBBFFEEFFBBFFEE -- patterns[9]: 0xFFBBFFFFFFBBFFFF -- patterns[10]: 0x8010022001084004 -- patterns[11]: 0xFFFFFFFFFFFFFFFF -- patterns[12]: 0x8822882288228822 -- patterns[13]: 0x1122448811224488 -- patterns[14]: 0xC4800C6843023026 -- patterns[15]: 0xB130031BD8C00C8D -- patterns[16]: 0xAA00AA00AA00AA00 -- patterns[17]: 0x8822552288225522 -- patterns[18]: 0x8855225588552255 -- patterns[19]: 0x77DD77DD77DD77DD -- patterns[20]: 0x8000000000000000 -- patterns[21]: 0xAA55AA55AA55AA55 -- patterns[22]: 0x038448300C020101 -- patterns[23]: 0x8244394482010101 -- patterns[24]: 0x8814224188412214 -- patterns[25]: 0x8080413E080814E3 -- patterns[26]: 0x22048C7422179810 -- patterns[27]: 0xBE808808EB088880 -- patterns[28]: 0x25C8328964244C92 -- patterns[29]: 0xA29C41BE2AC914EB -- patterns[30]: 0x40A00000040A0000 -- patterns[31]: 0x8040200002040800 -- patterns[32]: 0xAA00800088008000 -- patterns[33]: 0xFF80808080808080 -- patterns[34]: 0x081C22C180010204 -- patterns[35]: 0xFF808080FF080808 -- patterns[36]: 0xF87422478F172271 -- patterns[37]: 0xBF00BFBFB0B0B0B0 -- patterns[38]: 0xFF7FBE5DA2418000 -- patterns[39]: 0xFAF5FAF5A050A050 -- checksum: 0x0 ----- HyperTalk script ----- -- Demo Stack b1.3 -- 9 Feb 88 -- Sioux Lacy, David Donaldson, Wayne Robertson -- Demo Stack 2.0a13 -- Last Modification: 4/27/88 -- Modified by Mike Chiang on domenu menu --// Added by Medior, Inc. 2/20/90 global RPStackName if menu is in "Home,Quit HyperCard" and RPStackName is not empty then set cursor to watch put RPStackName into shortname repeat until offset(":",shortname) = 0 delete char 1 to offset(":",shortname) of shortname end repeat delete last char of shortname answer "This will return to "&shortname&"." with "Cancel" or "OK" if it is "Cancel" then exit domenu set cursor to watch lock screen go RPStackName unlock screen with dissolve exit domenu else pass doMenu end domenu function inDebug --used mainly for trapping arrow keys return (the shiftKey is down and the optionKey is down) end inDebug function debug --used for turning on and off the debugging traps --return true if the debugging is turned on --return false if the debugging is turned off return false end debug function stripSpaces string get offset (return, string) if it is not 0 then put empty into char it of string repeat get offset (" ", string) if it is 0 then return string put empty into char it of string end repeat end stripSpaces on openStack if the version < 1.2 then set lockMessages to true answer "This stack requires HyperCard 1.2 or higher." go home set lockMessages to true exit to HyperCard end if --check if the stack is lock set cantModify of this stack to false if (the cantModify of this stack) then set lockMessages to true answer "Please unlock this stack in the Finder." go home set lockMessages to true exit to HyperCard end if global QuotaHasChanged,connectMode,barMargin,barWidth, botMargin,sideMargin set userLevel to 5 set powerKeys to true set blindTyping to false put 15 into barMargin put 15 into botMargin put 15 into sideMargin put 60 into barWidth put "Simulation" into connectMode --default --get the connection mode --if connectMode is empty then --get the connection mode --set lockScreen to true --set lockMessages to true --push card --go card "Connect Setup" --put number of card buttons into numOptions --repeat with i = 1 to numOptions --if highlight of card button i then --put short name of card button i into connectMode --exit repeat --end if --end repeat -- pop card --set lockScreen to false --set lockMessages to false --end if if connectMode is empty then put "Simulation" into connectMode go to card "Connect Setup" --put false into QuotaHasChanged --if the optionKey is not down then -- hide menuBar -- hide message box --hide tool window --hide pattern window --go to card "Map of Regions" --set cursor to 4 --send "RetrieveAllData" to bkgnd "Map" --end if end openStack on closeStack set lockScreen to true push card go to card "Map of Regions" send "EraseMap" to bkgnd "Map" send "DisconnectFromVax" to bkgnd "Region Data" hide field "status" hide field "status backdrop" choose browse tool pop card set lockScreen to false end closeStack function repInfo repNum --given a rep number, return office_num,quota,sales,percent,last_name if repNum is empty then return empty put 1 into cdNum repeat put short id of card cdNum of background "Region Data" into myID get itemOffset(repNum,field "rep_nr" of card id myID) if it > 0 then exit repeat if cdNum = number of cards of background "Region Data" then exit repeat add 1 to cdNum end repeat if it = 0 then return empty put the short name of card id myID into myName if myName is "All Regions" then return empty put word 2 of myName into line 1 of data put item it of field "quota" of card id myID into line 2 of data put item it of field "sales" of card id myID into line 3 of data put item it of field "percent" of card id myID into line 4 of data put item it of field "last_name" of card id myID into line 5 of data return data end repInfo on arrowKey if inDebug() then pass arrowKey end arrowKey function maxItem itemList put 0 into largest repeat with i = 1 to the number of items in itemList if item i of itemList > largest then put item i of itemList into largest end if end repeat return largest end maxItem function addComma moneyItem if moneyItem contains "," then return moneyItem get the number of chars in moneyItem if it > 6 then put "," after char (it-6) of moneyItem return moneyItem end addComma function addDecimal moneyItem if moneyItem contains "." then return moneyItem return moneyItem & ".00" end addDecimal function deleteComma dataItem get offset (",", dataItem) if it is not 0 then put empty into char it of dataItem return dataItem end deleteComma function regionNumber cardName return word 2 of cardName end regionNumber function RegionalRepNums regionNum put "Region" && regionNum into cardName return field "rep_nr" of card cardName end RegionalRepNums function RegionalNames regionNum put "Region" && regionNum into cardName return field "last_name" of card cardName end RegionalNames function RegionalFigures regionNum put "Region" && regionNum into cardName return field "sales" of card cardName end RegionalFigures function RegionalPercents regionNum put "Region" && regionNum into cardName return field "percent" of card cardName end RegionalPercents function AllRegionSales return field "sales" of card "All Regions" end AllRegionSales function AllRegionNums return field "office_nr" of card "All Regions" end AllRegionNums function AllRegionQuotas return field "quota" of card "All Regions" end AllRegionQuotas -- This function doesn't appear to work function ThisRegionData regionNum put AllRegionNums() into regions put itemOffset (regionNum, regions) into itemNum put item itemNum of field "quota" of card "All Regions" & "," into data put item itemNum of field "sales" of card "All Regions" after data return data end ThisRegionData on DrawLargeBar area,percent --draw the large bars that are in the region & rep cards --the bar’s width is barWidth; sideMargin is not used here. global barWidth,botMargin set cursor to watch put item 1 of area into x1 put item 3 of area into x2 put item 2 of area into y1 put item 4 of area into y2 get (x2 - x1 - barWidth) div 2 put x1 + it into item 1 of area put x1 + it + barWidth into item 3 of area get y2 - botMargin put it - round ((it - y1) * percent / 100) into item 2 of area put it into item 4 of area reset paint set lineSize to 1 set filled to true DrawSingleBar area choose browse tool end DrawLargeBar on DrawSingleBar area --draw a bar of specified area --assume the paint settings have been pre-set. choose select tool drag from (item 1 to 2 of area) to (item 3 to 4 of area) doMenu "Opaque" set pattern to 12 doMenu Fill wait 10 set pattern to 22 doMenu Fill wait 10 set pattern to 14 doMenu Fill end DrawSingleBar on adjustFrameHeight --answer "Can't handle that large a % yet, but we will." with "OK" --exit to HyperCard end adjustFrameHeight -- Convert percents to 1 digit of precision function formatPercent num get offset (".", num) put empty into char it+2 to 16 of num return num & "%" end formatPercent function itemOffset anItem, list repeat with i = 1 to the number of items in list if item i of list = anItem then return i end repeat return 0 end itemOffset function lineOffset myLine, list repeat with i = 1 to the number of lines in list if line i of list = myLine then return i end repeat return 0 end lineOffset function addQuotes string return quote & string & quote end addQuotes on openCard hide menubar end openCard